package com.nisco.ampf;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;

public class Search1ManagerActivity extends Activity {

	// private ListView stackList;
	// private Button searchBtn;
	// private Button cameraSearch;
	// private Button changeSatckBtn;
	// private EditText stackLoc_oldEdit;
	// private EditText plateNo_oldEdit;
	// private EditText stackLoc_newEdit;
	// private TextView searchStateTxt;
	// private String[] list = null;
	// private String loginName;
	// WebServerConn serverConn;
	// DateSwitch dateSwitch;
	// ArrayList<HashMap<String, Object>> arrayList = null;
	// MyListViewAdapter myListViewAdapter;
	// ViewHolder viewHolder;
	// ProgressDialog myDialog = null;
	private EditText search1_EditText;
	private Button search1_btn;
	private ListView search1_listView;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.search_1);
		Intent intent = getIntent();
		search1_EditText = (EditText) findViewById(R.id.search1_EditTest);
		search1_btn = (Button) findViewById(R.id.search1_serBtn);
		search1_listView = (ListView) findViewById(R.id.search1_listView);
		// stackList = (ListView) findViewById(R.id.stackList);
		// searchBtn = (Button) findViewById(R.id.stackSerBtn);
		// cameraSearch = (Button) findViewById(R.id.cameraSearch);
		// changeSatckBtn = (Button) findViewById(R.id.changeSatckBtn);
		// stackLoc_oldEdit = (EditText) findViewById(R.id.stackLoc_oldEdit);
		// plateNo_oldEdit = (EditText) findViewById(R.id.plateNo_oldEdit);
		// stackLoc_newEdit = (EditText) findViewById(R.id.stackLoc_newEdit);
		// searchStateTxt = (TextView) findViewById(R.id.searchStateTxt);
		search1_btn.setOnClickListener(new btnClickListener());
		// changeSatckBtn.setOnClickListener(new btnClickListener());
		// cameraSearch.setOnClickListener(new btnClickListener());
		// stackList.setOnItemClickListener(new OnItemClickListener() {
		//
		// public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
		// long arg3) {
		// showDetail(arg1, arg2);
		// }
		// });
	}

	/**
	 * button监听事件
	 * 
	 * @author Robin
	 * 
	 */
	class btnClickListener implements OnClickListener {

		public void onClick(View v) {
			switch (v.getId()) {
			case R.id.search1_serBtn:// 查询

				String str = "";
				str = search1_EditText.getText().toString().toUpperCase();
				if (!str.equals("")) {
					new AlertDialog.Builder(Search1ManagerActivity.this)
							.setTitle("标题").setMessage(str)
							.setPositiveButton("确定", null).show();
				} else {
					str = "空值";
					new AlertDialog.Builder(Search1ManagerActivity.this)
					.setTitle("标题").setMessage(str)
					.setPositiveButton("空值", null).show();
				}
				break;
			default:
				break;
			}
		}
	}

	/**
	 * 文本框监听事件
	 * 
	 * @author Robin
	 * 
	 */
	class txtChangeListener implements TextWatcher {

		public void afterTextChanged(Editable s) {
			String temp = s.toString();
			String tem = temp.substring(temp.length() - 1, temp.length());
			char[] temC = tem.toCharArray();
			int mid = temC[0];
			// 数字
			if (mid >= 48 && mid <= 57) {
				return;
			}
			// 大写字母
			if (mid >= 65 && mid <= 90) {
				return;
			}
			// 小写字母
			if (mid >= 97 && mid <= 122) {
				return;
			}
			// 特殊字符 -、 \ 、/
			if (mid == 45 || mid == 47 || mid == 92) {
				return;
			}
			s.delete(temp.length() - 1, temp.length());

		}

		public void beforeTextChanged(CharSequence s, int start, int count,
				int after) {

		}

		public void onTextChanged(CharSequence s, int start, int before,
				int count) {

		}
	}
}
